/*
 *  CS45 Lab 1 Ben Marks, Cal Smith
 *
 *  Header file for history library. History is a circular
 *  buffer of size HISTSIZE, holding structs that have a
 *  command number and a command line. Included are procedures
 *  to add command lines to the history, display the contents
 *  of the history buffer, pull a command line out of the
 *  history buffer, and clean the history buffer for program
 *  close.
 */
#ifndef HISTORY_H
#define HISTORY_H

#define HISTSIZE 16

typedef struct {
  int num;
  char *cmd;
} hist_entry;

typedef struct {
  int num, newest;
  hist_entry hist[HISTSIZE];
} history;

int is_history_command(char *c);
void display_history(history *h);

void add_to_history(history *h, char *cl);

char * get_history(history *h, char *cl);

void free_history(history *h);

#endif
